home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld: Complete Mac Interactive
/
Macworld Complete Mac Interactive CD)(1994).iso
/
The Best of BMUG
/
Utilities
/
Text and Speech
/
Alpha.5.76
/
Tcl
/
SystemCode
/
markStack.tcl
< prev
next >
Wrap
Text File
|
1994-03-08
|
963b
|
41 lines
# ================================================================================
# Simple mark stack implementation
# ================================================================================
proc pushMark {} {
global markStack
global markName
set name mark$markName
incr markName
createTMark $name [getPos]
set fileName [lindex [winNames -f] 0]
set markStack [linsert $markStack 0 [list $fileName $name]]
message "Mark Pushed"
}
proc popMark {} {
global markStack
if {[llength $markStack] == "0"} {
alertnote "The mark stack is empty!"
return
}
set mark [lindex [lindex $markStack 0] 1]
set markStack [lreplace $markStack 0 0]
gotoTMark $mark
message "Mark Popped"
}
# Returns 'list' minus all top-level elements matching 'pat'.
# Used in 'closeHooks' to prune the mark stack.
proc removePat {list pat} {
while 1 {
set ind [lsearch $list $pat]
if {$ind == "-1"} {return $list}
set list [lreplace $list $ind $ind]
}
}